package com.aaa.service.impl;

import com.aaa.service.IJianHuangSefvice;
import com.ruibty.nsfw.NsfwService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Service
public class JianHuangServiceImpl implements IJianHuangSefvice {

    @Autowired
    private NsfwService nsfwService;


    @Override
    public boolean jh(MultipartFile file) {
        Float isYellow;
        try {
            isYellow= nsfwService.getPrediction(file.getBytes());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }


        //file.transferTo();

        System.out.println("对应的值是:"+isYellow);
        //
        if(isYellow>0.1f){
            return true;
        }
        return false;
    }
}
